﻿#ifndef FILEHANDLER_H
#define FILEHANDLER_H

#include <QFile>
#include <QDir>
#include <QTextStream>
#include <QMutex>
#include <QMutexLocker>

class FileHandler
{
public:
    static FileHandler *getInstance();
    FileHandler();
    ~FileHandler();

    const QString getFileDir();
    const QString getOutDir();
    void setFileDir(const QString &path);
    void setDefaultFileDir();
    QStringList getFileList();
    QString readFile(const QString &name);
    void writeFile(const QString &name, int *data, int length);

private:
    void handlerInit();

private:
    static FileHandler *instance;
    static QMutex *insMutex;
    const QString defaultDirPath;
    const QString defaultOutPath;

    QString fileDirPath;
    QString outDirPath;
    QDir fileDir;
    QDir outDir;
};

#endif // FILEHANDLER_H
